package com.mms.action.department;

import java.util.List;

import com.mms.dao.DepartmentManagementDao;
import com.mms.entity.Department;
import com.opensymphony.xwork2.Action;

public class ModifyDepartmentAction implements Action{

	private int startPage;
	private int deID;
	private String deName;
	private boolean ModifyisSuccess;
	private List<Department> departmentMes;
	private int account;
	
	
	public int getStartPage() {
		return startPage;
	}


	public void setStartPage(int startPage) {
		this.startPage = startPage;
	}


	public int getDeID() {
		return deID;
	}


	public void setDeID(int deID) {
		this.deID = deID;
	}


	public String getDeName() {
		return deName;
	}


	public void setDeName(String deName) {
		this.deName = deName;
	}


	public boolean isModifyisSuccess() {
		return ModifyisSuccess;
	}


	public void setModifyisSuccess(boolean modifyisSuccess) {
		ModifyisSuccess = modifyisSuccess;
	}


	public List<Department> getDepartmentMes() {
		return departmentMes;
	}


	public void setDepartmentMes(List<Department> departmentMes) {
		this.departmentMes = departmentMes;
	}


	public int getAccount() {
		return account;
	}


	public void setAccount(int account) {
		this.account = account;
	}


	@Override
	public String execute() throws Exception {
		// TODO Auto-generated method stub
		DepartmentManagementDao dmd = new DepartmentManagementDao();
		Department department = new Department();
		department.setDeId(deID);
		department.setDeName(deName);
		if(dmd.ModifyDepartment(department)){
			ModifyisSuccess = true;
		}else{
			ModifyisSuccess = false;
		}
		departmentMes = dmd.getDepCount(startPage);
		account = dmd.getcount();
		return "success";
	}

}
